ServiceNow Data Sources

You can add a ServiceNow data source to the KB, enabling data extraction from your ServiceNow knowledge base.

General Prerequisites

  • You have a ServiceNow developer account. If you don't have one, create it here.
  • You have already built a ServiceNow instance.
  • Your developer account has permissions to register apps.
  • You have a published DRUID bot.

Create OAuth client in ServiceNow

If you want to authenticate with OAuth when creating your ServiceNow data source, you need to create an OAuth client:

  1. Log into the ServiceNow developer portal.
  2. Click the Start building button.
  3. Your ServiceNow instance opens in a new browser window.
  4. In the All menu, search for 'Application registry' and click on it.
  5. The Application Registries page appears.
  6. Click the New button.
  7. Click on 'Create an OAuth API endpoint for external clients'.
  8. Enter a Name and in the Client secret field, enter a password.
  9. Copy the Client ID, you will need it in the DRUID Portal.
  10. Enter a password in the Client Secret field and save it securely. You will need this value later in the DRUID Portal.
  11. From the Client Type drop-down, select Integration as a Service.
  12. In the Auth Scopes table, double-click on Insert new row, enter useraccount and save the record.
  13. In the OAuth Application User field, enter the name of the user to which the OAuth app binds for client credential flow. Note that in this field you see only active users who haven been granted the roles rest_service or web_service_admin.
  14. Click the Submit button.
Hint:  As a best practice, create a dedicated integration user for each external client, e.g. “oauth_integration_druid”, give it only the roles rest_service (Internal Integration User) and web_service_admin (Web service access only), and select it as your OAuth Application User.

Adding ServiceNow data sources and extract data

This section explains how to add a ServiceNow data source and extract data from the ServiceNow Knowledge Base.

Step 1: Create the data source

  1. Click the Add New button. The Add New Data Source page opens.
  2. In the Name field, provide a name for the data source. This name helps you identify and search for the data source later.
  3. From the Language drop-down, select the language of the data you will upload. It must match one of the bot languages.
  4. From the Type drop-down, select ServiceNow. After you select the type, the content of the page displays additional fields required for adding a ServiceNow data source.
  5. Authenticate with ServiceNow. You can authenticate using Basic Authentication or OAuth:
    • Basic Authentication:
      1. From the Authentication type field, select Basic.
      2. Enter the credentials (Username and Password) of a ServiceNow user with roles rest_service and web_service_admin.
    • OAuth:
      1. From the Authentication type field, select OAuth.
      2. Enter the Client ID and Client Secret from your ServiceNow OAuth client.
  6. In the URL field, provide the ServiceNow Instance Base URL.
  7. To get the Instance URL, follow these steps:

    1. Log into the ServiceNow developer portal.
    2. Click on the Manage my instance button.
    3. Copy the Instance Base URL. Do not use the Copy icon, as it does not copy the full Base URL.
  8. The View endpoint field is prefilled with kb_view.do?sysparm_article={0}.
  9. In the Discovery table field, the default value is kb_knowledge?workflow_state=published. This table is used by the KB Engine to crawl only published articles.

  10. In the Content table field, enter the name of the ServiceNow table from which the KB Engine will extract data.
  11. If left empty, content will be downloaded from the view endpoint for each article (only if the page is public).

  12. In the Discovery batch size field, change the number of items extracted per page if needed.
  13. In the Content JSON paths field, specify the JSON paths to extract content from the response when querying the content table. Example: result.text, result.kb_question, result.kb_answer.
  14. If not specified, the entire content will be used.

  15. Optionally, set the Min score threshold and the Target match score for the data source. If not set, the thresholds from the Knowledge Base will apply.
  16. Click Create. The ServiceNow data source is now created and ready for crawling.

Step 2. Crawl the data source

Click the Crawl button at the top-right corner of the data source page.

Wait until the crawling process finishes. This prepares the data for extraction.

Step 3. Extract the data

Click the Extract button at the top-right corner of the data source page.

Wait until the extraction process completes.

Step 4. Train the data source

To ensure the KB Engine can search through the data source articles, train your data source after extraction.